<include file="../Public/_top" />
<script  type="text/javascript" src="__THEME__/js/rcalendar.js" ></script>
<style>
#rcalendar{font:14px Microsoft YaHei,SimSun,Arial !important}
</style>
<div class="content">
  <div class="wrap">
  <include file="./_left" />
        <div class="con_main">
          <div class="con_tit">
            <ul class="con_link">
              <li><a href="{:U('public/Index/index')}">班级列表</a></li>
              <li class="on"><a href="{:U('public/Index/addClass')}">新建班级</a></li>
            </ul>
          </div>
          <div class="con_box">
              <table style="width:400px;">
                <tr height="50">
                  <td>建档年份：</td>
                  <td>
                    <input name="class_grade" type="text" id="class_grade"  value="<php>echo date('Y');</php>" style="height:30px;width:50px;" />&nbsp;级&nbsp;&nbsp;
                    <select id="class_type" class="sel">
                      <option value="">-----请选择-----</option>
                      <option value="3">小班</option>
                      <option value="2">中班</option>
                      <option value="1">大班</option>
                      <option value="4">混龄班</option>
                    </select>
                  </td>
                </tr>
                <tr height="50">
                  <td>班级名称：</td>
                  <td>
                    <input name="time" type="text" id="class_name"  value="{$data.class_name}" style="height:30px;width:200px;padding:5px;" />
                  </td>
                </tr>
                <tr height="50">
                  <td>登录密码：</td>
                  <td>
                    <input name="time" type="text" id="pwd"  value="{$data.pwd}"  placeholder="以英文字母、数字、下划线等组成"  style="height:30px;width:200px;padding:5px;" />
                  </td>
                </tr>
              </table>
          </div>
          <div class="action_link tc small" style="border:0;">
            <a class="save" href="javascript:addClass();">确定</a>
            <a href="javascript::">取消</a>
          </div>
        </div>
    </div>
</div>
<script>
function addClass(){
  var class_grade=$("#class_grade").val();
  var class_type=$("#class_type").val();
  var class_name=$("#class_name").val();
  var pwd=$("#pwd").val();
  if(class_grade==""){
    alert("请输入年级");
    return;
  }
  if(class_type==0){
    alert("请选择班级类型");
    return;
  }
  if(class_name==""){
    alert("请输入班级名称");
    return;
  }
  if(pwd==""){
    alert("请输入登录密码");
    return;
  }
  $.ajax({
    type: "POST",
    url:"{:U('public/Index/doAddClass')}",
    data:"class_type="+class_type+"&class_name="+class_name+"&pwd="+pwd+"&class_grade="+class_grade,
    dataType:"text",
    success:function(data){
      if(isNaN(data)){
        alert(data);
      }else{
        window.location.href="{:U('public/Index/index')}";
      }
    }
  });
}
</script>
<include file="../Public/_foot" />
